package com.zjq.service;

import com.zjq.dao.BookStoreMapper;
import com.zjq.pojo.Cart;
import com.zjq.pojo.Comments;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public class BookStoreServiceImpl implements BookStoreService {
    public BookStoreMapper bookStoreMapper;

    public void setBookStoreMapper(BookStoreMapper bookStoreMapper) {
        this.bookStoreMapper = bookStoreMapper;
    }

    public int addComment(Comments comments) {
        return bookStoreMapper.addComment(comments);
    }

    public List<Comments> queryCommentsByBookId(int bookId) {
        return bookStoreMapper.queryCommentsByBookId(bookId);
    }

    public List<Comments> queryAllComment() {
        return bookStoreMapper.queryAllComment();
    }

    public int deleteCommentById(int commentId, int pId) {
        return bookStoreMapper.deleteCommentById(commentId,pId);
    }

    public List<Cart> queryCartByUserId(int id) {
        return bookStoreMapper.queryCartByUserId(id);
    }

    public int addCart(Cart cart) {
        System.out.println("-=---:::::::::::::"+cart);
        return bookStoreMapper.addCart(cart);
    }

    public int updateCartByid(int cartId,int counts) {
        return bookStoreMapper.updateCartByid(cartId,counts);
    }

    public int deletCartById(int id) {
        return bookStoreMapper.deletCartById(id);
    }

}
